package com.example.demo.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RegisterSuccessListener {


    @EventListener
    @Order(1)
    public void handleEamil(RegisterSuccessEvent registerSuccessEvent) {

        log.info("给用户{}发送邮件成功", registerSuccessEvent.getUser().getUserName());
    }

    @EventListener
    @Order(2)
    public void handlePrice(RegisterSuccessEvent registerSuccessEvent) {
        log.info("给用户{}发送优惠券成功", registerSuccessEvent.getUser().getUserName());
    }

    @EventListener
    @Order(3)
    public void handleMessage(RegisterSuccessEvent registerSuccessEvent) {
        log.info("给用户{}发送短信成功", registerSuccessEvent.getUser().getUserName());
    }


}
